import request from '@/utils/request'

export const fetchList = query => request({
  url: '/vite-vue-element-admin/article/list',
  method: 'get',
  params: query
})

export const fetchArticle = id => request({
  url: '/vite-vue-element-admin/article/detail',
  method: 'get',
  params: { id }
})

export const fetchPv = pv => request({
  url: '/vite-vue-element-admin/article/pv',
  method: 'get',
  params: { pv }
})

export const createArticle = data => request({
  url: '/vite-vue-element-admin/article/create',
  method: 'post',
  data
})

export const updateArticle = data => request({
  url: '/vite-vue-element-admin/article/update',
  method: 'post',
  data
})

export const fetchComments = id => request({
  url: `/article/${id}/comments`,
  method: 'get'
})
